<?php

session_start();
	$username = $_SESSION['username'];
	$id = $_SESSION['id'];

?>

<head>
	<link rel="stylesheet" type="text/css" href="profile_inner.css" />
</head>

<?php
	
	require_once "../common/PinSQL.obj";
	$pinSQL = new pinSQL();
	
	$row = $pinSQL->FetchNextRow();

?>

<img src="/img/icons/back.gif" /><a href="frame.php?page=profile"> Return to profile </a>

<div class="padded_text">
	<div class="head"><img src="/img/icons/upload.gif" /> Add Content</div>
	
	<p />What type of content would you like to add?
	
	<p />
	<table>
		<tr>
			<td width="128"><center> <img src="/img/icons/picture.png" /> </center></td>
			<td width="128"><center> <img src="/img/icons/song.png" /> </center></td>
			<!--<td width="128"><center> <img src="/img/icons/video.png" /> </center></td>
			<td width="128"><center> <img src="/img/icons/game.png" /> </center></td>!-->
			<td width="128"><center> <img src="/img/icons/entry.png" /> </center></td>
		</tr>
		
		<tr>
			<td><center>
				<a href="javascript:SelectDiv('picture_div');"> Picture </a>
			</center></td>
			
			<td><center>
				<a href="javascript:SelectDiv('song_div');"> Song </a>
			</center></td>
			
			<!--<td><center>
				<a href="javascript:SelectDiv('video_div');"> Video </a>
			</center></td>
			
			<td><center>
				<a href="javascript:SelectDiv('game_div');"> Game </a>
			</center></td>!-->
			
			<td><center>
				<a href="javascript:SelectDiv('entry_div');"> Blog Entry </a>
			</center></td>
		</tr>
	</table>
	
	<hr>
	
	<div id="picture_div" style="display: none;">
		<div class="subhead"><img src="/img/icons/picture.png" /> Add a Picture</div>
		<form name="pic" method="post" enctype="multipart/form-data" action="upload.php?type=pictures">
			<table>
				<tr>
					<td>Choose a picture to add:<div class="small">File types: .jpg, .gif, or .png</div></td>
					<td><input class="inputField" id="file" name="file" type="file" /></td>
				</tr>
				
				<tr>
					<td>Name this picture:</td>
					<td><input class="inputField" name="name" type="text" /></td>
				</tr>
				
				<tr>
					<td>Enter a caption for this picture:</td>
					<td><textarea class="inputField" name="caption" rows=4 cols=31></textarea></td>
				</tr>
				
				<tr>
					<td></td>
					<td><div class="small">I certify that all work I upload is my own and that I have the rights to distribute this content.</div></td>
				</tr>
				<tr>
					<td></td>
					<td><input name="submit" class="inputFieldR" type="submit" value="Add" onclick="StartUpload();"/></td>
				</tr>
			</table>
		</form>
	</div>
	
	<div id="song_div" style="display: none;">
		<div class="subhead"><img src="/img/icons/song.png" /> Add a Song</div>
		<form name="pic" method="post" enctype="multipart/form-data" action="upload.php?type=music">
			<table>
				<tr>
					<td>Choose a song to add:<div class="small">File types: .mp3, .wav</div></td>
					<td><input class="inputField" id="file" name="file" type="file" /></td>
				</tr>
				
				<tr>
					<td>Name this song:</td>
					<td><input class="inputField" name="name" type="text" /></td>
				</tr>
				
				<tr>
					<td>Enter a caption for this song:</td>
					<td><textarea class="inputField" name="caption" rows=4 cols=31></textarea></td>
				</tr>
				
				<tr>
					<td></td>
					<td><div class="small">I certify that all work I upload is my own and that I have the rights to distribute this content.</div></td>
				</tr>
				<tr>
					<td></td>
					<td><input name="submit" class="inputFieldR" type="submit" value="Add" onclick="StartUpload();"/></td>
				</tr>
			</table>
		</form>
	</div>
	
	<div id="entry_div" style="display: none;">
		<div class="subhead"><img src="/img/icons/entry.png" /> Add a Blog Entry</div>
		<form name="pic" method="post" enctype="multipart/form-data" action="upload.php?type=blog">
			<table>
				<tr>
					<td>Title this entry:</td>
					<td><input class="inputField" name="name" type="text" /></td>
				</tr>
				
				<tr>
					<td></td>
					<td><textarea class="inputField" name="caption" rows=15 cols=45></textarea></td>
				</tr>
				
				<tr>
					<td></td>
					<td><input name="submit" class="inputFieldR" type="submit" value="Post" onclick="StartUpload();"/></td>
				</tr>
			</table>
		</form>
	</div>
	
	<div id="pleasewait_div" style="display: none;"><img src="/img/uploading.gif" /> Please wait...</div>
	
</div>




<script type="text/javascript">

	function SelectDiv(divId)
	{
		// hide existing divs
		document.getElementById('picture_div').style.display = 'none';
		document.getElementById('song_div').style.display = 'none';
		//document.getElementById('video_div').style.display = 'none';
		//document.getElementById('game_div').style.display = 'none';
		
		// show selected div
		document.getElementById(divId).style.display = 'block';
	}

	function ToggleDiv(divId)
	{
		thisDiv = document.getElementById(divId);
		
		if (thisDiv.style.display == 'block')
		{
			thisDiv.style.display = 'none';
		} else {
			thisDiv.style.display = 'block';
		}
	}
	
	function StartUpload()
	{
		document.getElementById('pleasewait_div').style.display = 'block';
	}
	
</script>